package com.ilop.siteraudio.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;

/**
 * @author skygge
 * @date 2/2/21.
 * GitHub：javofxu@github.com
 * email：skygge@yeah.net
 * description：
 */
public class DateUtils {

    private static final String PATTERN = "MM dd, yyyy, HH:mm";

    /**
     * 得到当前时间
     * @return 时间
     */
    public static String getDayTime(){
        SimpleDateFormat dateFormat = getSimpleDateFormat(PATTERN);
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND));
        return dateFormat.format(calendar.getTime());
    }

    private static SimpleDateFormat getSimpleDateFormat(String pattern){
        return  new SimpleDateFormat(pattern, Locale.getDefault());
    }
}
